/*
	Copyright (C) 2013 Pontificia Universidad Catolica del Peru
	contact: http://avatar.inf.pucp.edu.pe/realidad-aumentada/
	address contact: Av. Universitaria 1801, San Miguel, Lima-Peru.
	
	This file is part of UbicAR PUCP.

	This program is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with This program.  If not, see <http://www.gnu.org/licenses/>.
*/
/*
	Authors: Alvaro Roger Agüero Sánchez, Rodolfo Javier Galvez Meza
	Pontificia Universidad Catolica del Peru
	Departamento de Ingeniería
*/

package org.grupoavatar.guiaubicua.howto;
 
import org.grupoavatar.guiaubicua.R;
import org.grupoavatar.guiaubicua.VAyuda;

import com.viewpagerindicator.CirclePageIndicator;

import android.app.Activity;
import android.os.Bundle;
import android.support.v4.view.ViewPager;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
 
public class Howto extends Activity {
 
	private static Howto activity;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.howto);
		
		activity = this;
 
		// Create and set adapter
		CustomPagerAdapter adapter = new CustomPagerAdapter(this);
		ViewPager myPager = (ViewPager) findViewById(R.id.customviewpager);
		myPager.setAdapter(adapter);
		myPager.setCurrentItem(0);
		
		// Add page change listener to pager component
		//myPager.setOnPageChangeListener(new CustomPageChangeListener(this));
		
		//Bind the title indicator to the adapter
		CirclePageIndicator titleIndicator = (CirclePageIndicator)findViewById(R.id.titles);
		 titleIndicator.setViewPager(myPager);
		 titleIndicator.setOnPageChangeListener(new CustomPageChangeListener(this));
		 
		Button buttonCerrar = (Button) findViewById(R.id.buttonCerrar);
		buttonCerrar.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				if (activity != null)
					activity.finish();
			}
		});
	}
 
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.howto, menu);
		return true;
	}
		
	public void SeAsocioCuenta() {
		CustomPageChangeListener.getCuentaButton().setVisibility(View.GONE);
		CustomPageChangeListener.getCuentaText().setVisibility(View.VISIBLE);
		VAyuda.debeReiniciar= true;
	}
}